import React, { Component } from 'react'
import { HashRouter, Route, Switch, Redirect } from 'react-router-dom'
import lazyload from '../utils/lazyload'
import Home from './home/home'
import main from './main/main'
//主路由配置

export default class MyIndex extends Component {
    render() {
        return (
            <div>
                <HashRouter>
                    <Route component={AdminProject} />
                </HashRouter>
            </div>
        )
    }
}

class AdminProject extends Component {
    render() {
        return (
            <div key={this.props.location.key}>
                <Switch>
                    <Route path="/" exact component={() => <Redirect to="/login" />} />
                    <Route path="/login" component={lazyload(() => import("./login/login"))} />
                    <Route path="/main" component={main} />
                    <Route path="/home" component={Home} />
                    <Route path="/404" component={lazyload(() => import("./errorPage/404"))} />
                    <Route render={() => <Redirect to="./404" />} />
                </Switch>
            </div>
        )
    }
}